package com.example.webchar.webchar.controller;

import com.example.webchar.webchar.service.NovelContentService;
import com.example.webchar.webchar.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @program: webchars
 * @description
 * @author: YouName
 * @create: 2021-08-28 09:07
 **/
@CrossOrigin
@RestController
@RequestMapping("/novelContent")
public class NovelContentController {


    @Autowired
    private NovelContentService novelContentService;

    /**
     * 根据章节id返回小说的内容信息
     *
     * @param chapterNameId
     * @return
     */
    @GetMapping("/novelContent/{chapterNameId}")
    public Result queryNovelContenOfChapterNameId(@PathVariable Integer chapterNameId) {
        return chapterNameId.equals(null) ? Result.fail().add("err", "请选择章节") : Result.success().add("success", novelContentService.quereyNovelContenofChapteNameIdService(chapterNameId));
    }



}
